﻿/* 
Copyright (c) 2009, Aaron Moline <Aaron.Moline@MolineSoftware.com>

Permission is hereby granted, free of charge, to any person 
obtaining a copy of this software and associated documentation 
files (the "Software"), to deal in the Software without restriction, 
including without limitation the rights to use, copy, modify, merge, 
publish, distribute, sublicense, and/or sell copies of the Software, 
and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be 
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN THE SOFTWARE.
*/
using CookComputing.XmlRpc;

namespace MolineSoftware.DrupalXmlRpc
{
    /// <summary>
    /// Struct: DrupalMail Struct
    /// </summary>
    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct DrupalMail
    {
        /// <summary>
        /// Gets or Sets the mail id.
        /// </summary>
        [XmlRpcMember(Description = "The unique id of the email", Member = "id")]
        public string DrupalMailID { get; set; }

        /// <summary>
        /// Gets or Sets who the email was sent to
        /// </summary>
        [XmlRpcMember(Description = "Gets or Sets who the email was sent to", Member = "to")]
        public string Receipent { get; set; }


        /// <summary>
        /// Gets or Sets who the Email was Sent From
        /// </summary>
        [XmlRpcMember(Description = "Gets or Sets who the Email was Sent From", Member = "from")]
        public string From { get; set; }

        /// <summary>
        /// Gets or Sets the <see cref="DrupalMailParam"/> information.
        /// </summary>
        [XmlRpcMember(Description = "The email paramaters", Member = "params")]
        public DrupalMailParam Params;

        /// <summary>
        /// Gets or Sets the Headers
        /// </summary>
        [XmlRpcMember(Description = "The email headers", Member = "headers")]
        public DrupalMailHeader Headers;

        /// <summary>
        /// Gets or Sets the Language
        /// </summary>
        [XmlRpcMember(Description = "The email language", Member = "language")]
        public XmlRpcStruct Language;

    }
    /* This is the structure returned from Drapal. 
        Array
        (
            [id] => system_service_1
            [to] => someuser@here.com
            [from] => aaron
            [language] => stdClass Object
                (
                    [language] => en
                    [name] => English
                    [native] => English
                    [direction] => 0
                    [enabled] => 1
                    [plurals] => 0
                    [formula] => 
                    [domain] => 
                    [prefix] => 
                    [weight] => 0
                    [javascript] => 
                )

            [params] => Array
                (
                    [subject] => Test from Drupla
                    [body] => this is my body <i>this hould be italic</i>
                    [headers] => Array
                        (
                        )

                )

            [subject] => Test from Drupla
            [body] => this is my body <i>this hould be italic</i>
            [headers] => Array
                (
                    [MIME-Version] => 1.0
                    [Content-Type] => text/plain; charset=UTF-8; format=flowed; delsp=yes
                    [Content-Transfer-Encoding] => 8Bit
                    [X-Mailer] => Drupal
                    [Errors-To] => someuser@here.com
                    [Return-Path] => someuser@here.com
                    [Sender] => someuser@here.com
                    [Reply-To] => aaron
                    [From] => aaron
                )

            [result] => 1
        )

     */

}
